<?php
$isadmin=1;
include "../../comm/tuaninc.php";
include('../check.php');

$sql="select id,name from ".$duoduo->BIAOTOU."mall where catid = ".TUANCID." and api_url is not null and api_url<>'' order by sort desc";
$query=$duoduo->query($sql);
while($row=$duoduo->fetch_array($query)){
    $mall_arr[$row['id']]=$row['name'];
}

$sql="select catename from ".$duoduo->BIAOTOU."catelist";
$query=$duoduo->query($sql);
while($row=$duoduo->fetch_array($query)){
    $cate_arr[$row['catename']]=$row['catename'];
}
$id=$_GET['id'];

$sql="select id,local,mall_id,catname,city,title,image,startTime,endTime,value,price,rebate,bought,sort,top from ".$duoduo->BIAOTOU."tuan_goods where `id` = '".$id."' limit 1";
$info = $duoduo->sqltoarr($sql,1);

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>管理中心</title>
<link href="../css/style.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="../../js/calendar/calendar-blue.css"/>
<script language="javascript" type="text/javascript" src="../../js/jquery.js"></script>
<script type="text/javascript" src="../../js/calendar/calendar.js"></script>
<script language="javascript" type="text/javascript">	
function openwinx(url,name,w,h)
{
    window.open(url,name,"top=100,left=400,width=" + w + ",height=" + h + ",toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,status=no");
}
</script>
<script charset="utf-8" src="../../kindeditor/kindeditor.js"></script>
<script>
$(function() {
	var editor = KindEditor.create('#content');
});
		</script>
<style type="text/css">
<!--
.STYLE1 {
	color: #FFFFFF;
	font-weight: bold;
	font-size:14px;
	text-decoration:none;
}
.STYLE2 {
	color: #555555;
	font-weight: bold;
	font-size:14px;
	text-decoration:none;
}
-->
</style>
</head>
<body topmargin="5" leftmargin="0">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="282" valign="top"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td>
          <table cellspacing="0" width="100%" height="207" style="border:1px  solid #DCEAF7;">
            <tr>
              <td height="30" colspan="2" bgcolor="E9F2FB" class="bigtext"><strong>&nbsp;<img src="../images/arrow.gif" width="16" height="22" align="absmiddle" />发布</strong></td>
            </tr>
            <tr>
              <td width="100%" colspan="2" valign="top"><table width="100%" height="300" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td valign="top"><form id="form1" name="form1" method="post" action="save.php">
                 <table width="100%"  align="center" border=1 cellpadding=0 cellspacing=0 style="border-collapse: collapse" bordercolor="#dddddd">
                      <tr>
                        <td width="74" height="30" align="right" class="bigtext">类别：</td>
                        <td width="540" height="30" class="bigtext">&nbsp;<?=$duoduo->select($cate_arr,"info[catname]",$info['catname'],$interval=10)?>
                        &nbsp;&nbsp;城市：<input name="info[city]" type="text" style="width:30px"  value="<?=$info['city']?>"/>
                        &nbsp;&nbsp;网站：<?=$duoduo->select($mall_arr,"info[mall_id]",$info['mall_id'],$interval=10)?>
                        &nbsp;&nbsp;排序：<input name="info[sort]" type="text" style="width:30px"  value="<?=$info['sort']?>"/>
                        &nbsp;&nbsp;置顶：<label><input name="info[top]" type="radio" <?php if($info['top']==1){?> checked="checked"<?php }?> value="1"/>是</label> <label><input name="info[top]" type="radio" <?php if($info['top']==0){?> checked="checked"<?php }?> value="0"/>否</label> 
                        </td>
                      </tr>
                      <tr>
                        <td width="74" height="30" align="right" class="bigtext">购买人数：</td>
                        <td width="540" height="30" class="bigtext">&nbsp;<input name="info[bought]" type="text" style="width:40px"  value="<?=$info['bought']?>"/>
                        &nbsp;&nbsp;原价：<input name="info[value]" type="text" style="width:40px"  value="<?=$info['value']?>"/>
                        &nbsp;&nbsp;现价：<input name="info[price]" type="text" style="width:40px"  value="<?=$info['price']?>"/>
                        &nbsp;&nbsp;折扣：<input name="info[rebate]" type="text" style="width:40px"  value="<?=$info['rebate']?>"/>
                        </td>
                      </tr>
                      <tr>
                        <td width="74" height="30" align="right" class="bigtext">商品名：</td>
                        <td width="540" height="30" class="bigtext">&nbsp;<input name="info[title]" type="text" size="60" id="url" value="<?=$info['title']?>"/>
                         </td>
                      </tr>
                      <tr>
                        <td width="74" height="30" align="right" class="bigtext">开始时间：</td>
                        <td width="540" height="30" class="bigtext">&nbsp;<input id="startTime" name="info[startTime]" type="text" size="16" value="<?=date('Y-m-d H:i:s',$info['startTime'])?>"/>
                        &nbsp;&nbsp;&nbsp;结束时间：&nbsp;<input id="endTime" name="info[endTime]" type="text" size="16" value="<?=date('Y-m-d H:i:s',$info['endTime'])?>"/> （格式化时间：2010-10-10 12:12:12）</td>
                     <script language="javascript" type="text/javascript">
					 date = new Date();
					 document.getElementById ("startTime").value="<?=date('Y-m-d H:i:s',$info['startTime'])?>";
					document.getElementById ("endTime").value="<?=date('Y-m-d H:i:s',$info['endTime'])?>";
					Calendar.setup({
						inputField     :    "startTime",
						ifFormat       :    "%Y-%m-%d %H:%M:%S",
						showsTime      :    true,
						timeFormat     :    "24"
					});
					Calendar.setup({
						inputField     :    "endTime",
						ifFormat       :    "%Y-%m-%d %H:%M:%S",
						showsTime      :    true,
						timeFormat     :    "24"
					});
				 </script>
                      </tr>
                      <tr>
                        <td width="74" height="30" align="right" class="bigtext">图片：</td>
                        <td height="30">&nbsp;<input name="info[image]" id="pic" type="text" style="width:388px" maxlength="255" value="<?=$info['image']?>" /><input type="button" value="上传图片" onclick="javascript:openwinx('../upload_pic.php?uploadtext=pic','upload','450','350')" /></td>
                      </tr>
                      <tr>
                        <td width="74" height="30" align="right" class="bigtext">网址：</td>
                        <td width="540" height="30" class="bigtext">&nbsp;<input name="info[local]" type="text" size="60" id="url" value="<?=$info['local']?>"/>
                         </td>
                      </tr>
                      <tr>
                        <td width="74" height="30" align="right" class="bigtext">介绍：</td>
                        <td width="540" height="30" class="bigtext">
                        <textarea id="content" name="info[content]" style="width:700px;height:300px;visibility:hidden;">
                        <?=htmlspecialchars($info ['content'])?>
                        </textarea>
                         </td>
                      </tr>
                      <tr>
                        <td height="30" align="right" class="bigtext">提交：</td>
                        <td height="30" style="text-align:center; width:600px"><input type="submit" value="提&nbsp;&nbsp;交" /></td>
                      </tr>

                    </table>
                    <input type="hidden" name="info[id]" value="<?=$info['id']?>"  />
                  </form>
                  </td>
                </tr>
              </table></td>
            </tr>
          </table></td>
        </tr>
      
    </table></td>
  </tr>
</table>
</body>
</html>
